package com.shengqi.xinnongren.work.ui.user.activities;

import android.content.Context;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

import com.shengqi.xinnongren.R;
import com.shengqi.xinnongren.common.base.BaseActivity;

import butterknife.BindView;
import butterknife.OnClick;

public class ReChargeSuccessActivity extends BaseActivity {

    private static final String EXTRA_TYPE = "type";
    private static final String EXTRA_MONEY = "money";
    @BindView(R.id.tv_pay_type)
    TextView tv_pay_type;
    @BindView(R.id.tv_money)
    TextView tv_money;

    private int mType;
    private String mMoney;

    /**
     * @param context
     * @param type    1,支付宝2,微信
     * @param money   金额
     */
    public static void start(Context context, int type, String money) {
        Intent intent = new Intent(context, ReChargeSuccessActivity.class);
        intent.putExtra(EXTRA_TYPE, type);
        intent.putExtra(EXTRA_MONEY, money);
        context.startActivity(intent);
    }

    @Override
    protected int setContentLayoutRes() {
        return R.layout.activity_re_charge_success;
    }

    @Override
    protected void initView() {
        Intent intent = getIntent();
        if (intent != null) {
            mType = intent.getIntExtra(EXTRA_TYPE, 0);
            mMoney = intent.getStringExtra(EXTRA_MONEY);
        }
    }

    @Override
    protected void initData() {
        tv_pay_type.setText(mType == 1 ? "支付宝" : "微信");
        tv_money.setText(String.format("%s元", mMoney));
    }

    @OnClick(R.id.tv_complete)
    void tv_complete() {
        startActivity(new Intent(this, MyWalletActivity.class));
        finish();
    }


}
